package com.example.demo.study;

import java.time.LocalDateTime;

public class Test {
    public static int count = 1;
    public static final String str = new String("fff");
    public static final LocalDateTime ldt = LocalDateTime.now();
    private Account account = new Account(5);


//    public Test() {
//        account = new Account(4);
//    }

    {
        account = new Account(3);
    }

    public static void main(String[] args) {
        Test test = new Test();
        // 构造方法中的赋值是最后执行，最终起作用，
        // 显示赋值和代码块赋值哪个起作用却决于定义的先后顺序
        System.out.println(test.account.price);
    }

    public static void method() {
        System.out.println("fff");
    }
}
class Account{
    public int price;
    public Account(int price){
        this.price = price;
    }
}
